﻿using System;
using System.Windows.Forms;

namespace Library.Winform.Draw.Tools {
  public abstract class ToolGraphic : IToolGraphic {
    protected ToolGraphic() {
      Cursor = Cursors.Default;
    }
    protected Cursor Cursor;
    #region Implementation of IToolGraphic

    public void OnMouseDown(IDrawContainer container, MouseEventArgs e) {
      OnMouseDown(container, new ScrollMouseEventArgs(e.Button, e.Clicks, e.X + container.ScrollOffset.X, e.Y + container.ScrollOffset.Y, e.Delta));
    }

    public void OnMouseMove(IDrawContainer container, MouseEventArgs e) {
      OnMouseMove(container, new ScrollMouseEventArgs(e.Button, e.Clicks, e.X + container.ScrollOffset.X, e.Y + container.ScrollOffset.Y, e.Delta));
    }

    public void OnMouseUp(IDrawContainer container, MouseEventArgs e) {
      OnMouseUp(container, new ScrollMouseEventArgs(e.Button, e.Clicks, e.X + container.ScrollOffset.X, e.Y + container.ScrollOffset.Y, e.Delta));
    }

    public void OnMouseClick(IDrawContainer container, MouseEventArgs e) {
      OnMouseClick(container, new ScrollMouseEventArgs(e.Button, e.Clicks, e.X + container.ScrollOffset.X, e.Y + container.ScrollOffset.Y, e.Delta));
    }


    public virtual void OnDoubleClick(IDrawContainer container, EventArgs e) {

    }

    public void OnMouseDoubleClick(IDrawContainer container, MouseEventArgs e) {
      OnMouseDoubleClick(container, new ScrollMouseEventArgs(e.Button, e.Clicks, e.X + container.ScrollOffset.X, e.Y + container.ScrollOffset.Y, e.Delta));
    }


    #endregion

    protected abstract void OnMouseDown(IDrawContainer container, ScrollMouseEventArgs e);

    protected abstract void OnMouseMove(IDrawContainer container, ScrollMouseEventArgs e);

    protected abstract void OnMouseUp(IDrawContainer container, ScrollMouseEventArgs e);

    protected abstract void OnMouseClick(IDrawContainer container, ScrollMouseEventArgs e);

    protected abstract void OnMouseDoubleClick(IDrawContainer container, ScrollMouseEventArgs e);


  }
}
